package cn.wink.springcloud.service.imp;

import cn.wink.springcloud.service.PaymentService;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.stereotype.Service;
/**
 * 
 * 
 * @author xw
 * @date 2020-05-02 10:55
 */
@Service
public class PaymentServiceImpl implements PaymentService{


    @HystrixCommand(fallbackMethod = "fallbackMethod")      //启动服务降级
    @Override
    public String selectByPrimaryKey(Long id) {
        return "get id"+id;
    }

    private String fallbackMethod(Long id) {
        return "服务提供者：服务降级,无法正确响应，提前定义的错误信息或响应";
    }
}
